﻿namespace WinnerCMS.Common.Security.CodeCharts
{
    using Security;
    using System;
    using System.Collections;
    using System.Linq;

    internal static class UpperMiddle
    {
        public static IEnumerable Bamum()
        {
            return CodeChartHelper.GetRange(0xa6a0, 0xa6f7);
        }

        public static IEnumerable Bopomofo()
        {
            return CodeChartHelper.GetRange(0x3105, 0x312d);
        }

        public static IEnumerable BopomofoExtended()
        {
            return CodeChartHelper.GetRange(0x31a0, 0x31b7);
        }

        public static IEnumerable CjkCompatibility()
        {
            return CodeChartHelper.GetRange(0x3300, 0x33ff);
        }

        public static IEnumerable CjkRadicalsSupplement()
        {
            return CodeChartHelper.GetRange(0x2e80, 0x2ef3, i => i == 0x2e9a);
        }

        public static IEnumerable CjkStrokes()
        {
            return CodeChartHelper.GetRange(0x31c0, 0x31e3);
        }

        public static IEnumerable CjkSymbolsAndPunctuation()
        {
            return CodeChartHelper.GetRange(0x3000, 0x303f);
        }

        public static IEnumerable CjkUnifiedIdeographs()
        {
            return CodeChartHelper.GetRange(0x4e00, 0x9fcb);
        }

        public static IEnumerable CjkUnifiedIdeographsExtensionA()
        {
            return CodeChartHelper.GetRange(0x3400, 0x4db5);
        }

        public static IEnumerable CommonIndicNumberForms()
        {
            return CodeChartHelper.GetRange(0xa830, 0xa839);
        }

        public static IEnumerable CyrillicExtendedA()
        {
            return CodeChartHelper.GetRange(0x2de0, 0x2dff);
        }

        public static IEnumerable CyrillicExtendedB()
        {
            return CodeChartHelper.GetRange(0xa640, 0xa697, i => ((i == 0xa660) || (i == 0xa661)) || ((i >= 0xa674) && (i <= 0xa67b)));
        }

        public static IEnumerable EnclosedCjkLettersAndMonths()
        {
            return CodeChartHelper.GetRange(0x3200, 0x32fe, i => i == 0x321f);
        }

        public static IEnumerable HangulCompatibilityJamo()
        {
            return CodeChartHelper.GetRange(0x3131, 0x318e);
        }

        public static IEnumerable Hiragana()
        {
            return CodeChartHelper.GetRange(0x3041, 0x309f, delegate (int i) {
                if (i != 0x3097)
                {
                    return i == 0x3098;
                }
                return true;
            });
        }

        public static IEnumerable IdeographicDescriptionCharacters()
        {
            return CodeChartHelper.GetRange(0x2ff0, 0x2ffb);
        }

        public static bool IsFlagSet(UpperMidCodeCharts flags, UpperMidCodeCharts flagToCheck)
        {
            return ((flags & flagToCheck) != UpperMidCodeCharts.None);
        }

        public static IEnumerable Kanbun()
        {
            return CodeChartHelper.GetRange(0x3190, 0x319f);
        }

        public static IEnumerable KangxiRadicals()
        {
            return CodeChartHelper.GetRange(0x2f00, 0x2fd5);
        }

        public static IEnumerable Katakana()
        {
            return CodeChartHelper.GetRange(0x30a0, 0x30ff);
        }

        public static IEnumerable KatakanaPhoneticExtensions()
        {
            return CodeChartHelper.GetRange(0x31f0, 0x31ff);
        }

        public static IEnumerable LatinExtendedD()
        {
            return CodeChartHelper.GetRange(0xa720, 0xa78c).Concat<int>(CodeChartHelper.GetRange(0xa7fb, 0xa7ff));
        }

        public static IEnumerable Lisu()
        {
            return CodeChartHelper.GetRange(0xa4d0, 0xa4ff);
        }

        public static IEnumerable ModifierToneLetters()
        {
            return CodeChartHelper.GetRange(0xa700, 0xa71f);
        }

        public static IEnumerable Phagspa()
        {
            return CodeChartHelper.GetRange(0xa840, 0xa877);
        }

        public static IEnumerable Saurashtra()
        {
            return CodeChartHelper.GetRange(0xa880, 0xa8d9, i => (i >= 0xa8c5) && (i <= 0xa8cd));
        }

        public static IEnumerable SupplementalPunctuation()
        {
            return CodeChartHelper.GetRange(0x2e00, 0x2e31);
        }

        public static IEnumerable SylotiNagri()
        {
            return CodeChartHelper.GetRange(0xa800, 0xa82b);
        }

        public static IEnumerable Vai()
        {
            return CodeChartHelper.GetRange(0xa500, 0xa62b);
        }

        public static IEnumerable YijingHexagramSymbols()
        {
            return CodeChartHelper.GetRange(0x4dc0, 0x4dff);
        }

        public static IEnumerable YiRadicals()
        {
            return CodeChartHelper.GetRange(0xa490, 0xa4c6);
        }

        public static IEnumerable YiSyllables()
        {
            return CodeChartHelper.GetRange(0xa000, 0xa48c);
        }
    }
}

